package com.changgou.user.feign;

import com.changgou.entity.Result;
import com.changgou.user.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@FeignClient(name = "user")
public interface UserFeign {

    @GetMapping("/user/load/{username}")
    public Result<User> findByUsername(@PathVariable("username") String username);

    @GetMapping(value = "/user/search" )
    public Result<List<User>> findList(@RequestParam Map searchMap);

    @PostMapping("/user")
    public Result add(@RequestBody User user);

    /**
     * 头像上传,保存图片路径
     */
    @PutMapping("/user/edit/headPic")
    public Result editHeadPic(@RequestParam("headPic") String headPic);

    /**
     * 编辑用户信息
     */
    @PostMapping("/user/edit/editUserInfo")
    public Result editUserInfo(@RequestBody Map<String,String> map);

    //原密码修改新密码
    @PostMapping("/user/changepassword")
    public Result changePassword(@RequestBody Map map);

    //给原手机发消息
    @GetMapping("/user/sendoldphonesms")
    public Result sendoldphonesms();

    //校验原手机验证码
    @GetMapping("/user/checkoldphone")
    public Result checkoldphone(@RequestParam("smsCode") String smsCode);

    //给新手机发送验证码
    @GetMapping("/user/sendnewphone")
    public Result sendphonesms(@RequestParam("mobile") String mobile);

    //校验新手机验证码
    @GetMapping("/user/changephone/{mobile}/{smscode}")
    public Result changephone(@PathVariable("mobile") String mobile,@PathVariable("smscode") String smscode);
}
